Dynamic DBE placement (GUIs)

I am trying to figure out how a built in GUI for DOORS works. The GUI is the internal history viewer for a given module.

Whenever I want to place DBEs on a GUI using constrained placement I can occupy a space on my GUI by only 1 DBE. I can hide or show the DBE, however, I am unable to replace one DBE by another dynamically without restarting the GUI or creating a new dialog.

The built-in history view has a way around this that I would love to reproduce.

1- Open a module with links.
2- right click on an object with a link and check out the properties of that object.

On the history tab you will notice that the DBE's are replaced one by another (old Value, new Value are replaced by Link Information DBE). How is this achieved?
PatrickGuay - Mon Feb 20 10:21:58 EST 2012

Re: Dynamic DBE placement (GUIs)
Mathias Mamsch - Mon Feb 20 11:55:43 EST 2012

Hi Patrick,

the idea is to place the elements over one another, by for example anchoring the first element on each tab to the top left corner. Then you use hide and show to actively show the elements of the tab that you are building. It is stupid to implement that mechanism (collect the items of each tab in a skip list, then override the switch page callback, show and hide the elements) so as a giveaway of the day, I append the TabControl class, which will do most of that stupid work for you.

The way it is used is as follows:

#include <../lib/std/TabControl.inc>
 
// Make the dialog, decide on the tabs that you will implement: 
DB diag = centered "Tab Test" 
 
string arTabs[] = {"About", "Log" }
TabControl tb = createTabControl (diag, arTabs) 
tb -> "top" -> "form" 
 
// Build About Page, tell the tabcontrol about it!
setCurrentPage (tb, "About")
 
// do NOT place this item under tab control
DBE x = label (diag, "This label will stay on About and Log") // => tb
x -> "top" -> "inside" -> tb; x -> "left" -> "form"
 
// place this item under tab control in 'About' tab
DBE y = label (diag, "This label will only be on tab 'about'!") => tb 
y -> "top" -> "spaced" -> x; y -> "left" -> "form"
 
// place this item under tab control in 'About' tab
DBE z = label (diag, "This library is nice!")=> tb  
z -> "top" -> "spaced" -> y; z -> "left" -> "form"; z-> "bottom" -> "form"
 
// Build Log tab
setCurrentPage (tb, "Log")
 
// place this item under tab control in 'Log' tab
DBE fld =  text(diag, "", "", 200, 80, true) => tb
fld -> "top" -> "spaced" -> x; fld -> "left" -> "form"
 
// do this once before starting the GUI, so all will be shown correctly
switchPage tb 
 
show diag

 


Maybe that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 


Attachments

attachment_14791836_TabControl.zip

Re: Dynamic DBE placement (GUIs)
PatrickGuay - Mon Feb 20 12:22:02 EST 2012

Thanks for getting all struct on me :) I will have to analyze this in more detail. I greatly appreciate your daily free-bee.